From d96c9af4a37e1dcbe8366013ab089a909585d54a Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 30 Aug 2006 18:19:04 +0100 Subject: [PATCH] [XEN] Add a start_pfn field in xen_domctl_getmemlist. This is used by ia64 because it directly reads the P2M table. Signed-off-by: Tristan Gingold --- tools/libxc/ia64/xc_ia64_stubs.c | 16 +++++----------- xen/arch/ia64/xen/dom0_ops.c | 4 ++-- xen/include/public/domctl.h | 5 ++++- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/tools/libxc/ia64/xc_ia64_stubs.c b/tools/libxc/ia64/xc_ia64_stubs.c index 6b3639ff52..f6376508d3 100644 --- a/tools/libxc/ia64/xc_ia64_stubs.c +++ b/tools/libxc/ia64/xc_ia64_stubs.c @@ -36,7 +36,6 @@ xc_ia64_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf, struct xen_domctl domctl; int num_pfns,ret; unsigned int __start_page, __nr_pages; - unsigned long max_pfns; xen_pfn_t *__pfn_buf; __start_page = start_page; @@ -44,27 +43,22 @@ xc_ia64_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf, __pfn_buf = pfn_buf; while (__nr_pages) { - max_pfns = ((unsigned long)__start_page << 32) | __nr_pages; domctl.cmd = XEN_DOMCTL_getmemlist; - domctl.domain = (domid_t)domid; - domctl.u.getmemlist.max_pfns = max_pfns; + domctl.domain = (domid_t)domid; + domctl.u.getmemlist.max_pfns = __nr_pages; + domctl.u.getmemlist.start_pfn =__start_page; domctl.u.getmemlist.num_pfns = 0; set_xen_guest_handle(domctl.u.getmemlist.buffer, __pfn_buf); - if ((max_pfns != -1UL) - && mlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)) != 0) { + if (mlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)) != 0) { PERROR("Could not lock pfn list buffer"); return -1; } ret = do_domctl(xc_handle, &domctl); - if (max_pfns != -1UL) - (void)munlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)); + (void)munlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)); - if (max_pfns == -1UL) - return 0; - num_pfns = domctl.u.getmemlist.num_pfns; __start_page += num_pfns; __nr_pages -= num_pfns; diff --git a/xen/arch/ia64/xen/dom0_ops.c b/xen/arch/ia64/xen/dom0_ops.c index 0ff54d2507..63eb81bb02 100644 --- a/xen/arch/ia64/xen/dom0_ops.c +++ b/xen/arch/ia64/xen/dom0_ops.c @@ -39,8 +39,8 @@ long arch_do_domctl(xen_domctl_t *op, XEN_GUEST_HANDLE(xen_domctl_t) u_domctl) { unsigned long i; struct domain *d = find_domain_by_id(op->domain); - unsigned long start_page = op->u.getmemlist.max_pfns >> 32; - unsigned long nr_pages = op->u.getmemlist.max_pfns & 0xffffffff; + unsigned long start_page = op->u.getmemlist.start_pfn; + unsigned long nr_pages = op->u.getmemlist.max_pfns; unsigned long mfn; if ( d == NULL ) { diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index ac21cc95af..aaeba06662 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -16,7 +16,7 @@ #include "xen.h" -#define XEN_DOMCTL_INTERFACE_VERSION 0x00000001 +#define XEN_DOMCTL_INTERFACE_VERSION 0x00000002 #define uint64_t uint64_aligned_t @@ -72,7 +72,10 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t); #define XEN_DOMCTL_getmemlist 6 struct xen_domctl_getmemlist { /* IN variables. */ + /* Max entries to write to output buffer. */ uint64_t max_pfns; + /* Start index in guest's page list. */ + uint64_t start_pfn; XEN_GUEST_HANDLE_64(xen_pfn_t) buffer; /* OUT variables. */ uint64_t num_pfns; -- 2.30.2